﻿#include "MyWidget.h"
#include <QPainter>
#include <QDebug>

MyWidget::MyWidget(QQuickItem *parent ):QQuickPaintedItem(parent)
{


}

void MyWidget::paint(QPainter *painter)
{
    painter->setRenderHints(QPainter::Antialiasing);

    painter->setPen(Qt::red);
    painter->setBrush(QBrush(Qt::red));
    painter->drawRect(QRect(0,0,this->width(),this->height()));

//    painter.drawRect(this->rect());

}

void MyWidget::setView(MyWidget *view)
{
    if (view) {
        qDebug() << view->width();
    } else {
        qDebug() << "error";
    }
}
